
<div id="center_tieude">
    <img src="../../Picture/admin.ico"/>
    <h3>Danh Sách Tài Khoản</h3>        
</div> <!--end id center_tieude-->

<div id="timkiem_them">
<form action="" method="post">
    <select name="timkiem_taikhoan">
        <option value="tendangnhap">Tìm theo tên đăng nhập</option>
        <option value="quyen">Tìm theo quyền</option>
        <option value="active">Tìm theo Active</option>
    </select>
    <label style="float:left; margin:10px;">Từ khóa:</label>
    <input style="float:left; margin:10px;" type="search" name="key" value=""/>
    <input style="float:left; margin:10px;" type="submit" name="timkiem" value="Tìm Kiếm"/>
</form>
</div><!--end id timkiem_them-->
<table border="1px" cellspacing="0px" width="700px">
  <tr>
      <th>
          Tên Đăng Nhập
      </th>
      <th>
          Mật Khẩu
      </th>
      <th>
          Trạng Thái
      </th>
      <th>
          Quyền
      </th>
      <th>
          Active
      </th>
      <th colspan="2">
          <a href="admin.php?obj=taikhoan&act=ad"><img title="Thêm tài khoản" alt="Thêm tài khoản" src="../../Picture/ad.png"/></a>
      </th>
  </tr>
  
  <?php
	  		if(isset($_GET['trang']))
			{
				$page=$_GET['trang'];
				$arr=dangnhap::GetAll($page,9);
				for($i=0;$i<count($arr);$i++)     
				{    
				?>  	
					 <tr>
                        <td width="20px" height="80px"><?php echo $arr[$i]->idSanPham?></td>
                        <td style="overflow:scroll; width:100px; height:80px; column-fill:auto;"><?php echo $arr[$i]->Ten?> </td>
                        <td width="80px" height="80px"><?php echo $arr[$i]->Gia?></td>
                        <td width="80px" height="80px"><?php echo $arr[$i]->NhaSX?></td>
                        <td width="80px" height="80px">
                              <?php 
                                  if($arr[$i]->TrangThai==1)
                                      echo "Còn hàng";
                                  else
                                      echo "Hết hàng";
                              ?>
                        </td>
                        <td  style="overflow-x:scroll" width="160px" height="80px"><?php echo $arr[$i]->MoTa?></td>
                        <td  style="overflow-x:scroll;" width="80px" height="80px"><img id="hinhanh" src="<?php echo "../../".$arr[$i]->Hinh; ?>" height="50px" width="50px" /></td>
                        <td width="50px" height="80px"><?php echo $arr[$i]->DeNghi?></td>
                        <td>
                          <a href="./admin.php?obj=sanpham&act=update&id=<?php echo $arr[$i]->idSanPham ?>">
                              <img title="Sửa sản phẩm" src="../../Picture/update.png"/>
                          </a>
                        </td>
                        <td>
                          <a href="./admin.php?obj=sanpham&act=delete&id=<?php echo $arr[$i]->idSanPham ?>">
                              <img title="Xóa sản phẩm" src="../../Picture/del.png"/>
                          </a>
                       </td>     
                     </tr>
     <?php
          		}
			}
			else
			{
				$page=1;
				$arr=dangnhap::GetAll($page,9);
				for($i=0;$i<count($arr);$i++)     
				{    
				?>  	
					 <tr>
                        <td>
                            <?php echo $arr[$i]->tendangnhap;?>
                        </td>
                        <td>
                            <?php echo $arr[$i]->matkhau;?>
                        </td>
                        <td>
                            <?php
                              
                                  echo "Online";
                              
                                  
                             ?>
                        </td>
                        <td>
                            <?php 
                              if($arr[$i]->quyen == 1)
                                  echo "Admin";
                              else
                                  echo "Khách hàng";		
                          ?>
                        </td>
                        <td>
                            <?php
                              if($arr[$i]->active==1)
                                  echo "Active";
                              else
                                  echo "Banned";
                             ?>
                        </td>
                        <td>
                            <a href="admin.php?obj=taikhoan&act=update&id=<?php echo $arr[$i]->tendangnhap;?>"><img title="Sửa tài khoản" alt="Sửa tài khoản" src="../../Picture/update.png"/></a>
                        </td>
                        <td>
                            <a href="admin.php?obj=taikhoan&act=delete&id=<?php echo $arr[$i]->tendangnhap;?>"><img title="Xóa tài khoản" alt="Xóa tài khoản" src="../../Picture/del.png"/></a>
                        </td>
                    </tr>
     <?php
          		}
			}		
      ?>

</table><!--end class danhmuc-->
<div id="trang">
	<?php
		if(!isset($_GET["trang"]))
			$_GET["trang"]=1;
		if(isset($_GET["obj"])&&$_GET["obj"]=='taikhoan')
		{
		$a = dangnhap::CountTaiKhoan();
		$sotrang = ceil($a/9);
		$hientai = $_GET["trang"];
			for ($page = 1;(int)$page<=$sotrang;$page++ )
			{
				if($hientai != $page)
				{ echo "
					<a href='admin.php?obj=taikhoan&trang=$page'>$page</a>";
				}
				else
				{
					echo "<b>".$page."</b>";
				}
			}
		}
		
?>
</div>
  
</table><!--end class danhmuc-->